//品牌服务
app.service("brandService",function ($http) {
    //1.查询所有品牌列表
    this.findAll = ()=>{
        return $http.get("../brand/list.do");
    }
    //2.分页查询所有品牌
    this.findByPage = (page,pagesize)=>{
        return $http.get("../brand/findByPage.do?page="+page+"&pagesize="+pagesize);
    }
    //3.分页带条件查询品牌列表
    this.search = (page,pagesize,entity)=>{
        return $http.post("../brand/search.do?page="+page+"&pagesize="+pagesize,entity);
    }
    //4.保存品牌
    this.save = (entity)=>{
        let url = "";//添加添加或修改的url地址
        //如果entity.id有值就进行修改
        if (entity.id){
            url = "../brand/update.do"
        } else {
            url = "../brand/add.do"
        }
        return $http.post(url,entity);
    }
    //5.根据用户选择的品牌id列表删除多个品牌
    this.dele = (ids)=>{
        return $http.get("../brand/delete.do?ids="+ids);
    }
})